<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">
        <div><?php include "../public_flow/flow_show_info.php";?></div>
        <div class="tongbox tongbox5">
            <div class="tuo"><div class="tit">项目名称</div><div class="con" id="tong_enginname"></div></div>
            <div class="tuo"><div class="tit">收票登记单号</div><div class="con" id="tong_number"></div></div>
            <div class="tuo"><div class="tit">收票金额(元)</div><div class="con" id="tong_money"></div></div>
            <div class="tuo"><div class="tit">收票日期</div><div class="con" id="tong_dt"></div></div>
            <div class="tuo"><div class="tit">经手人</div><div class="con" id="tong_baner"></div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">项目信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">项目名称</td><td class="tv colorlan" id="enginid_name" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>
        <div class="table-box tablenes">
            <div class="title">收票信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">收票主题</td><td id="title" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">收票登记单号</td><td id="number"></td><td class="tt">受票单位</td><td id="shouer" class="tv"></td></tr>
                <tr><td class="tt">收票金额(元)</td><td id="money" class="tv"></td><td class="tt">收票税额(元)</td><td id="ratefee" class="tv"></td></tr>
                <tr><td class="tt">收票日期</td><td id="dt"></td><td class="tt">经手人</td><td id="baner" class="tv"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">收票明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>


        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>


    <div class="showrrboxtext">
        <div class="table-box tablenes">
            <div class="title">项目票税</div>
            <div class="tuo"><div class="tit">项目开票金额(元)</div><div class="con" id="right_kai_money">0</div></div>
            <div class="tuo"><div class="tit">销项税额(元)</div><div class="con" id="right_kai_ratefee">0</div></div>
            <div class="tuo"><div class="tit">项目收票金额(元)</div><div class="con" id="right_shou_money">0</div></div>
            <div class="tuo"><div class="tit">进项税额(元)</div><div class="con" id="right_shou_ratefee">0</div></div>
            <div class="tuo"><div class="tit">应计增值税(元)</div><div class="con" id="right_zengzhifee">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">发票类型</div>
            <div class="tuo"><div class="tit">专用发票(元)</div><div class="con" id="right_money_zhuan">0</div></div>
            <div class="tuo"><div class="tit">普通发票(元)</div><div class="con" id="right_money_pu">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">发票费用类别</div>
            <div class="tuo"><div class="tit">材料发票(元)</div><div class="con" id="right_money_cai">0</div></div>
            <div class="tuo"><div class="tit">人工发票(元)</div><div class="con" id="right_money_ren">0</div></div>
            <div class="tuo"><div class="tit">机械设备发票(元)</div><div class="con" id="right_money_ji">0</div></div>
            <div class="tuo"><div class="tit">专业分包发票(元)</div><div class="con" id="right_money_fen">0</div></div>
            <div class="tuo"><div class="tit">其他费用发票(元)</div><div class="con" id="right_money_qi">0</div></div>
        </div>
    </div>
    <div><?php include '../public/shrrbox.php'?></div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_piao_shou_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                $("#flowdingname").text(data.title);

                if(engininfo){
                    $("#tong_enginname").text(engininfo.name);
                }
                $("#tong_number").text(data.number);
                $("#tong_money").text(parseFormatNum(data.money));
                $("#tong_dt").text(data.dt);
                $("#tong_baner").text(data.baner);


                if(engininfo){
                    $("#right_kai_money").text(parseFormatNum(engininfo.kai_money)).addClass('colorlan').click(function () {
                        openNavPage('查看项目开票信息','piao_kai/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_kai_ratefee").text(parseFormatNum(engininfo.kai_ratefee)).addClass('colorlan').click(function () {
                        openNavPage('查看项目开票信息','piao_kai/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_shou_money").text(parseFormatNum(engininfo.shou_money)).addClass('colorlan').click(function () {
                        openNavPage('查看项目收票信息','piao_shou/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_shou_ratefee").text(parseFormatNum(engininfo.shou_ratefee)).addClass('colorlan').click(function () {
                        openNavPage('查看项目收票明细信息','piao_shou/detail.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_zengzhifee").text(parseFormatNum(engininfo.zengzhifee));
                }
                $("#right_money_zhuan").text(parseFormatNum(data.money_zhuan));
                $("#right_money_pu").text(parseFormatNum(data.money_pu));
                $("#right_money_cai").text(parseFormatNum(data.money_cai));
                $("#right_money_ren").text(parseFormatNum(data.money_ren));
                $("#right_money_ji").text(parseFormatNum(data.money_ji));
                $("#right_money_fen").text(parseFormatNum(data.money_fen));
                $("#right_money_qi").text(parseFormatNum(data.money_qi));










                if(engininfo){
                    $("#enginid_name").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }

                $("#title").text(data.title);
                $("#number").text(data.number);
                $("#shouer").text(data.shouer);
                $("#money").text(showChineseNumber(data.money));
                $("#ratefee").text(showChineseNumber(data.ratefee));
                $("#dt").text(data.dt);
                $("#baner").text(data.baner);
                $("#explain").text(data.explain);



                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field:'',title:'合同名称',templet: function(d){
                                return  '<div onclick="show_caiinfo('+d.caiid+')" class="colorlan">'+d.caiid_name+'</div>';
                            }}
                        ,{field: 'gonger', title: '开票单位'}
                        ,{field: 'dt', title: '开票日期'}
                        ,{field: 'nums', title: '发票号码'}
                        ,{field: 'piaotype_name', title: '发票类型'}
                        ,{field: 'fee', title: '不含税金额(元)',align:'right',templet: function(d){return parseFormatNum(d.fee);}}
                        ,{field: 'rate', title: '税率(%)'}
                        ,{field: 'ratefee', title: '税额(元)',align:'right',templet: function(d){return parseFormatNum(d.ratefee);}}
                        ,{field: 'money', title: '价税合计(元)',align:'right',templet: function(d){return parseFormatNum(d.money);}}
                        ,{field: 'yongtype_name', title: '费用类别'}
                        ,{field: 'explain', title: '备注'}


                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('piao_shou', param_id);
    });



    function show_caiinfo(caiid) {
        if(caiid > 0){
            openPage('../contract_cai/show.php?id='+caiid);
        }
    }

</script>
</body>
</html>




